<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!-- security标准标签库 -->
<%@ taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>首页</title>
<link rel="stylesheet" href="webjars/jquery-ui/1.12.1/jquery-ui.css">
<style type="text/css">
body {
	/* 外边距 */
	margin: 0;
	/* 内边距 */
	padding: 0;
}

.container {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

.top {
	height: 50px;
	background-color: #F0F8FF;
	flex-grow: 0;
	color: white;
	/* 居中布局 */
	display: flex;
	flex-direction: column;
	/* 主轴居中 */
	justify-content: center;
	color: #000000;
}

.top>div>h3 {
	/* 左内边距 */
	padding-left: 1em;
	display: inline-block;
	/* 左浮动 */
	float: left;
}

.top>div>div {
	/* flex布局 */
	display: flex;
	flex-direction: column;
	/* 主动对齐方式 */
	justify-content: center;
	/* 右浮动 */
	float: right;
	/* 右边距 */
	padding-right: 30px;
}

.top>div>div span {
	/* 上边距 */
	margin-top: 20px;
}

.center {
	background-color: blue;
	flex-grow: 1;
	display: flex;
	flex-direction: row;
}

.bottom {
	background-image: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%);
	height: 50px;
	flex-grow: 0;
}

.leftMenu {
	width: 200px;
	/* 列表项背景色 */
	background-color: #FFF5EE;
	flex-flow: 0;
}

.workspace {
	flex-grow: 1;
	background: white;
}

.ui-accordion .ui-accordion-content {
	padding: 1em 0.5em;
}

.ui-accordion .ui-accordion-content .ui-widget.ui-widget-content {
	border-width: 0;
}

.ui-accordion .ui-accordion-content  .ui-menu .ui-menu-item {
	line-height: 2em;
}

#work {
	background-image: linear-gradient(to top, #a8edea 0%, #fed6e3 100%);
	padding: 1em 5em;
}

.button1 {
 -webkit-transition-duration: 0.4s;
 transition-duration: 0.4s;
 padding: 13px 28px;
 text-align: center;
 background-color: white;
 color: black;
background: #ee0979; 
background: linear-gradient(to right, #ee0979, #ff6a00);
 border-radius:4px;
 }
 .button1:hover {
 background-color: #4CAF50;
 color: white;
 }
</style>
<script type="text/javascript" src="webjars/jquery/3.5.1/dist/jquery.js"></script>
<script type="text/javascript" src="webjars/jquery-ui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript" src="static/custom.js"></script>
<script type="text/javascript">
$(function() {
	$('#dialog9').dialog({
		autoOpen:false,
		title:"修改密码",
		model:true,
		width:400,
		buttons:[{
			text:'提交',
			click:function(){
					var self=$(this);
					var form=$(this).find('form');
					var forms=form[0];
					var pwd1=forms.password1.value;
					var pwd2=forms.password2.value;
					var params=form.serialize();
					if(pwd1.lengrh==0){
							alert('密码不能为空');
							return;
						}
					if(pwd1!=pwd2){
							alert('两次密码不一样');
							return;
						}
					$.post('password/save',params,function(data){
							self.dialog('close');
							alert('修改成功！');
							window.setTimeout("Rangesh",500);
						})
						
				}
		},{
			text: '退出',
			click: function(){
					$(this).dialog('close');		
				}
			}]
	})
})
	function Rangesh(){
		window.location="login?logout";
		}

	function xgmm(){
			$('#dialog9').load("password/edit",function(){
				$('#dialog9').dialog('open');
				})
		}
</script>
<script type="text/javascript">
	$(function() {
		$('#accordion').accordion({
			heightStyle : 'fell'
		});
		$('.mainMenu').menu();
		$('.mainMenu li').click(function() {
			var self = $(this);
			var url = self.attr("src");
			$('#work').load(url);
		})
	})

</script>
</head>
<body>
<div id="dialog6" style="display: none;"></div>
<div id="dialog9" style="display:none;"></div>
	<div class="container">
		<div class="top">
			<div>
				<h3>成绩管理程序</h3>		
				<div>
					<%-- <sec:authentication property="principal.name"/>获取用户真实姓名 --%>
					<span>欢迎你：
						<sec:authorize access="!hasRole('ROLE_DIY')">
						<sec:authentication property="principal.name" />
						</sec:authorize>
						<button onclick="JavaScript:xgmm()" class="button1">修改密码</button>
						<a href="logout" style="margin-left: 1em;">注销</a></span>
				</div>
			</div>
		</div>
		<div class="center">
			<div class="leftMenu">
				<div id="accordion">
					<h3>成绩管理</h3>
					<div>
						<sec:authorize
							access="hasRole('ROLE_ADMIN')||hasRole('ROLE_TEACHER')">
							<ul class="mainMenu">
								<li src="classGrade/manage"><a>班级成绩录入</a></li>
								<li src="selfGrade/manage"><a>个人成绩录入</a></li>
								<li src="grade/allStudentGrade"><a>班级成绩查询</a></li>
							</ul>
						</sec:authorize>
						<sec:authorize access="hasRole('ROLE_STUDENT')">
							<ul class="mainMenu">
								<li src="grade/personGrade"><a>个人成绩查询</a></li>
								<li src="grade/gradetable"><a>班级成绩查询</a></li>
							</ul>
						</sec:authorize>
					</div>
					<sec:authorize access="hasRole('ROLE_ADMIN')">
						<h3>系统设置</h3>
						<div>
							<ul class="mainMenu">
								<li src="course/manage"><a>课程管理</a></li>
								<li src="classmanage/manage"><a>班级管理</a></li>
								<li src="studentmanage/manage"><a >学生管理</a></li>
							</ul>
						</div>
					</sec:authorize>
				</div>
			</div>
			<div class="workspace" id="work">
				<h3>学生登录账号为学号</h3>
				<h3>学生登录初始密码为1111</h3>
				<h3>教师登录账号admin1</h3>
				<h3>成绩登录密码1234</h3>
			</div>
		</div>
		<div class="bottom">
		<h3>让你害怕的不是未知的未来，而是不断重複著过去的错误。</h3>

		</div>
	</div>
</body>
</html>